package cn.hsp;

import java.sql.Connection;
import java.sql.Driver;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Properties;

public class Jdbc1 {
    public static void main(String[] args) {
        try {
            Driver driver = new com.mysql.cj.jdbc.Driver();
            String url = "jdbc:mysql://localhost:3307/empdb";
            Properties info = new Properties();
            info.setProperty("user","root");
            info.setProperty("password","0616");
            Connection conn = driver.connect(url,info);
            Statement s = conn.createStatement();
            String sql="insert into hero values (null,'赵云',125)";
            s.executeUpdate(sql);
            s.close();
            conn.close();
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }
}
